unit Logic;

interface

uses DBCtrls, cxDBEdit, SysUtils;


function Chek2Int(rgPut: TDBRadioGroup; rgVag: TDBRadioGroup): Integer; overload;
function Chek2Int(rgPut: TcxDBRadioGroup; rgVag: TcxDBRadioGroup): Integer; overload;

  procedure SetFiltr(rgPut: TcxDBRadioGroup; rgVag: TcxDBRadioGroup);


overload

implementation

uses
  DMUnit;



  function Chek2Int(rgPut: TDBRadioGroup; rgVag: TDBRadioGroup): Integer; overload;
  begin
    Result := rgPut.ItemIndex + rgVag.ItemIndex * 10;

  end;

  function Chek2Int(rgPut: TcxDBRadioGroup; rgVag: TcxDBRadioGroup): Integer; overload;
  begin
    Result := (rgPut.ItemIndex + 1) + (rgVag.ItemIndex + 1) * 10;


  end;

  procedure SetFiltr(rgPut: TcxDBRadioGroup; rgVag: TcxDBRadioGroup);
  var
    strFiltr: string;
    P1, P2 :integer;
    sP1, sP2 : string;
  begin

    //DBEdit20
    //tblMetrosname

    strFiltr :=  'P1 = ' + IntToStr(rgPut.ItemIndex +1) + ' AND ' + 'P2 = ' + IntToStr(rgVag.ItemIndex +1) ;
    strFiltr :=  'sname = ''' + DM.tblMetrosname.AsString + ''' AND ' + 'P1 = ' + IntToStr(rgPut.ItemIndex +1) + ' AND ' + 'P2 = ' + IntToStr(rgVag.ItemIndex +1) ;

    if (rgPut = nil) then begin
             strFiltr := 'P2 = ' + IntToStr(rgVag.ItemIndex +1) ;
                          end;

    dm.tblMetro.Filtered :=False ;
    dm.tblMetro.Filter := strFiltr;
    dm.tblMetro.Filtered := True ;

{
    strFiltr := IntToStr(r_type);
    dm.tblMetro.Filtered :=False ;
    dm.tblMetro.Filter := 'r_type = ' + strFiltr;
    dm.tblMetro.Filtered := True ;
}
  //dm.JvDBFilter1.Filter :=

  end;

end.

